import struct, sys

# endian
i = 0x0102
print(f'{struct.pack("h",i) = }')
print(f'{struct.pack("<h",i) = }')
print(f'{struct.pack(">h",i) = }')
print(f"{sys.byteorder = }")

# pack & unpack
print(f'{(s := struct.pack("b",100)) = }')
print(f'{chr(struct.unpack("b",s)[0]) = }')
